<? 
	include("../model/database.php");
	include("../model/xl_dia_diem.php");
	include("../model/xl_binh_luan_dia_diem.php");
	include("../model/xl_hinh_anh_dia_diem.php");
	
	$xl_binh_luan = new xl_binh_luan_dia_diem();
	$xl_hinh_anh = new xl_hinh_anh_dia_diem();
	$xl_dia_diem = new xl_dia_diem();
	
	$id = $_POST['idnhom'];
	$last_id = $_POST['lastid'];
	
	$arrDDNext = $xl_dia_diem->dsDiaDiemTheoNhom_ViewMore_Next($id,$last_id);

	$l = count($arrDDNext);
	$l_p = $arrDDNext[$l-1];
	$id_l = $l_p['MaDiaDiem'];
	
	foreach($arrDDNext as $row){
		$image = $xl_hinh_anh->hinhAnhDiaDiem($row['MaDiaDiem']);
		$hinhdaidien = $image[0]['DuongDan'];
		$sobinhluan = $xl_binh_luan->tong_binh_luan($row['MaDiaDiem']);
?>
	<div class="place-item"><!--một địa điểm-->
		<div class="place-avatar">
			<?
				if($hinhdaidien != ''){					
			?>
			<a href="./?action=dia-diem&amp;idPlace=<?=$row['MaDiaDiem']?>">
			<img src="uploads/place/<?=$hinhdaidien?>" alt="<?=$row['TenDiaDiem']?>">
			</a>
			<? } else{?>
			<a href="./?action=dia-diem&amp;idPlace=<?=$row['MaDiaDiem']?>">
				<img src="uploads/place/photo_not_available.png" alt="<?=$row['TenDiaDiem']?>">
			</a>
			<? }?>
		</div>
		<ul class="place-info">
			<li class="first">
				<a class="place-title" title="<?=$row['TenDiaDiem']?>" href="./?action=dia-diem&amp;id=<?=$row['MaDiaDiem']?>&amp;name=<?=$row['TenDiaDiem']?>"><?=$row['TenDiaDiem']?></a>
			</li>
			<li>
			<span class="address-details"><?=$row['DiaChi']?></span>
			</li>
			<li>
			<img class="icon" title="lượt xem" src="images/icon_views.png">
			Lượt xem:
			<span class="page-views"><?= number_format($row['soluotxem'],0,',',',')?></span>
			</li>
			<li>
			<img class="icon" title="bình luận" src="images/icon_comment.png">
			Bình luận:
			<span class="comment-no"><?=number_format($sobinhluan,0,',',',')?></span>
			</li>
		</ul>
		<div class="clear"></div>
	</div><!--[end] một địa điểm-->
	<?
	}
	
	?>
	<? if($l>=10){ ?>
        <input type="hidden" id="idnhom" name="idnhom" value="<?=$l_p['MaNhomDiaDiem']?>" />
        <a id="<?=$id_l?>" class="more">xem thêm</a>
        <div class="clear"></div>
	<? } ?>